<?php
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_huifuapi/model')->方法名();
*/
namespace jy_huifuapi;
defined('BY_JYA') or exit('error');
class model extends \plugin{
	public function uplog($res,$tid='',$type=0){
		$insert=array(
				'uniacid'=>$_SESSION['uniacid'],
				'mid'=>$_SESSION['uid'],
				'tid'=>$tid,
				'res'=>ijson_encode($res),
				'type'=>$type,
				'createtime'=>TIMESTAMP,
		);
		pdo_insert('jy_huifuapi_log',$insert);
		return true;
	}
	public function checklog($tid='',$type=0){
		$log=pdo_get('jy_huifuapi_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'tid'=>$tid,'type'=>$type),'','id desc');
		$log['res']=json_decode($log['res'],true);
		if($log['createtime']<1715929546){
			$log['res']['passed']=0;
		}
		return $log;
	}
	public function gethuifu_id($mid=''){
		$log=pdo_get('jy_huifuapi_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$mid,'type'=>2),'','id desc');
		$log['res']=json_decode($log['res'],true);
		if($log['createtime']<1715929546){
			$log['res']['passed']=0;
		}
		return $log['res']['huifu_id'];
	}
}
?>